#include "process.h"
char style[S_NUM] = {'#','-','>','+','.'};

void ProncessOn()//函数定义
{
    int cnt = 0;
    char bar[NUM];
    memset(bar,'\0',sizeof(bar));
    //reverse
    const char *lable = "|\\-/";

    //101 times
    while(cnt<=100)
    {
        printf("[%-100s][%3d%%][%c]\r",bar,cnt,lable[cnt%4]);//\r:每次回到行头输出,%-100s:向右对齐100位,%%:显示%
        //printf("\033[40;44m[%-100s][%3d%%][%c]\033[0m\r",bar,cnt,lable[cnt%4]);//带颜色输出
        fflush(stdout);//刷新缓存区，每次都输出
        bar[cnt++] = style[N];
        //sleep(1);
        usleep(50000);//5s跑完==> 一次0.05s ==> 50000us
    }
   printf("\n");//防止跑完紧挨着命令行 
    
}
